package com.java;

import org.springframework.beans.factory.BeanNameAware;

import javax.annotation.PostConstruct;

public class BeanLifeComponent implements BeanNameAware {

    @Override
    public void setBeanName(String s) {
        //通知方法
        System.out.println("执行了 BeanNameAware ->"+s);
    }
    @PostConstruct
    public void doPostConstruct(){
        //使用注解的初始化方式
        System.out.println("执行了@PostConstruct");
    }

    public void myInit(){
        //使用xml的初始化方式
        System.out.println("执行了myInit");
    }

    public void sayHi(){
        System.out.println("Bean");
    }
}
